'''
Created on 23/09/2012

@author: Charles Murray
'''

class Subtree(object):
    '''
    classdocs
    '''

    subtree = []

    def __init__(self, item):
        '''
        Constructor
        '''
        self.subtree = item
        
    def __iter__(self):
        return self.subtree.__iter__()
    
    def addTree(self, item):
        self.subtree.append(item)
        
    def getOptions(self):
        options = []
        for child in self.subtree:
            option = []
            option.append(child.getItem().getStart())
        return options
        
    def getItem(self):
        return self.item
    
    def getFirst(self):
        return self.subtree[0]
    
    def findId(self, name):
        for item in self.subtree:
            if item.getId() == name:
                return item
        return None
        
        
        